package leetcode;

import java.util.Scanner;

/**
 * ClassName: DianXinT1
 * Package: leetcode
 * Description:
 *
 * @Author wjn
 * @Create 2025/9/27 09:45
 * @Version 1.0
 */
public class DianXinT1 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String s = scanner.next();

        int count = 0;

        for(int i = 0; i < s.length(); i++){
            char c = s.charAt(i);
            if (c == 'p' || c == 'b' || c == 'd' || c == 'q') {
                count++;
            }
        }
        System.out.println(count);
        scanner.close();
    }
}
